草庐IT

php - 检查有效的 guid

全部标签

javascript - Chrome 中的打印功能不再有效

我们的网站具有可以打印成员(member)资料的功能。它的工作方式是通过onsubmit将javascript函数附加到按钮。javascript函数使用window.open以特殊模式重新打开页面,重新显示页面的打印机友好版本。此功能大约从2008年开始就已经存在,并且适用于所有浏览器。除了大约一周前,它已经停止在Chrome中工作。使用Chrome时,打开的窗口会打开,但随后会短暂打开另一个空白窗口,然后所有窗口都会关闭。在搜索有关此问题的讨论时,我无法找到确切的问题,但确实找到了一些内容,说应该在onsubmit中添加“returnfalse”。我尝试添加它,但没有帮助。这是on

javascript - "new new Something"如何在 JavaScript 中产生有效结果?

我目前正在开发一个JavaScript解析器并研究ECMAScript5.1specification.这是一个让我困惑的问题。§11.2Left-Hand-SideExpressions定义了以下NewExpression产生式:NewExpression:MemberExpressionnewNewExpression如果我没看错的话,NewExpression可能是这样的newnewSomething(实际上,任何数量的新。)这让我很困惑。newSomething怎么可能返回任何你可以再次new的东西?有可能吗? 最佳答案 它

javascript - 如何检查特定div下的特定文本框是否为空

我有这个代码:我需要让用户知道他是否将文本框留空,我尝试过类似的方法..(不起作用)我错过了什么?$('.greenDiv>input:text').blur(function(){if(!$(this).val()){alert("fillthisfield");}}); 最佳答案 尝试使用input[type=text]代替$('.greenDiv>input[type=text]').blur(function(){if(!$.trim($(this).val())){alert("fillthisfield");}});

javascript - 检查 jQuery 是否单击了包含 img 的 anchor 元素

如何检查点击的元素是否是包含img的anchor?例如,我想检查这个元素是否被点击:jQuery(document).click(function(e){//e.target.hereIsWhereINeedHelp;});提前致谢! 最佳答案 如果你想捕捉任何元素的“点击”:jQuery(document).click(function(e){if(jQuery(e.target).is('a')&&jQuery(e.target).has('img')){//codegoeshere}});您是否选择阻止“默认行为”是另一个问题

javascript - Angular2 ElementRef nativeElement 检查元素是否被禁用

我的指令中有这个,名为“bgcolor”:exportclassBgColorDirective{constructor(el:ElementRef){console.log(el.nativeElement.disabled);//show"false"if(el.nativeElement.disabled){el.nativeElement.style.backgroundColor='#5789D8';el.nativeElement.style.color='#FFFFFF';}}在我的模板中,我有:我不明白为什么el.nativeElement.disabled返回fals

javascript - 如何检查三元运算符中的 undefined variable ?

我对三元运算有疑问:leta=undefined?"Defined!":"DefinitelyUndefined",b=abc?"Defined!":"DefinitelyUndefined",//ReferenceErrorc=(abc!==undefined)?"Defined!":"DefinitelyUndefined",//ReferenceErrord=(typeofabc!=="undefined")?"Defined!":"DefinitelyUndefined"//results:a=d="DefinitelyUndefined",//whilebandcthrowR

javascript - 如何使用 jQuery each 函数检查 NaN 的数组值?

我有这些从数据库中获取数据的HTML代码。我将一个数组设置为HTML输入。HTML代码CategoryJanuaryFebruaryFetchArray("select*fromtable");if(count($sql)>0){foreach($sqlas$row){$i=0;if($i==0){?>"placeholder=""readonly>"placeholder=""readonly>"placeholder=""readonly>"placeholder=""readonly>"placeholder=""readonly>Totaljan1[]的值在console.lo

javascript - 如何检查我的 iPhone Safari 上运行的 Ajax 请求的状态?

我的网站上加载了这段代码fingerprintingpageloaded.//console.log(window);functiongetIPhoneModel(){//CreateacanvaselementwhichcanbeusedtoretrieveinformationabouttheGPU.varcanvas=document.createElement("canvas");if(canvas){varcontext=canvas.getContext("webgl")||canvas.getContext("experimental-webgl");if(context

javascript - 不明白为什么这段代码有效

如果用户的浏览器是IE,并且localStorage不存在,下面的代码设置一个localStorage,它的有效期为24小时。(functionieAlert(){varlastclear=window.localStorage.getItem('myLocalStorage'),time_now=(newDate()).getTime();varisIE=document.documentModeif(isIE&&!lastclear){if((time_now-lastclear)>1000*60*60*24){window.localStorage.clear()window.l

javascript - 如何通过 JavaScript 或 CSS 检查用户是否处于高对比度模式

当按下Shift+Left+Alt+Print时,Windows切换到高对比度模式-是否有有机会在网页上检测到它(使用JavaScript或CSS)吗?是否有机会在HTTP-Request(也就是服务器端,例如通过PHP或Ruby)中检测到它? 最佳答案 根据thisarticleaboutusingCSSspritesinhighcontrast,在Windows上的高对比度模式下,背景图像应设置为“无”,并且它还会更改背景颜色。这应该覆盖任何CSS样式表。因此,您可以在初始渲染后执行一些javascript来检测它。查看他的de